package com.fjc.exception;

import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;

@ControllerAdvice
public class ExceptionsHandler {

    //Shiro配置权限不足页面不起作用，采用捕获该异常的方式进行跳转
    @ExceptionHandler(AuthorizationException.class)
    public void shiroUnauthorization(HttpServletResponse response)throws Exception{
        response.sendRedirect("/403");
    }
}
